Enable ARP (strictARP: true) on the cluster.
kubectl edit configmap -n kube-system kube-proxy
Apply manifests (for namespace and metallb).
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml
Create secret (first install only).
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
Edit the config, adding the address pool that will be available to the load balancer. This can be either internal or externap IPs.
$ vim metal_config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- <ip_range_low>-<ip_range_high>
Note that if want to serve a single internal load balancer accessible from the VM's IP (e.g. via a reverse proxy), the range here should be set to the IP of the VM.
Apply this config.
kubectl apply -f metal_config.yaml
To force a reset, delete all pods in metallb-system
namespace:
kubectl delete po -n metallb-system --all